import { reqCategory, reqBanner, reqFloor } from "@/api"

const actions = {
    async categoryList(context) {
        let result = await reqCategory()
        if (result.code === 200) {
            context.commit('CATEGORYLIST', result.data)
        }
    },
    async getBannerList(context) {
        let result = await reqBanner()
        if (result.code === 200) {
            context.commit('BANNERLIST', result.data)
        }
    },
    async getFloorList(context) {
        let result = await reqFloor()
        if (result.code === 200) {
            context.commit('FLOORLIST', result.data)
        }
    }
}

const mutations = {
    CATEGORYLIST(state, mycategorylist) {
        state.categoryList = mycategorylist
    },
    BANNERLIST(state, mybannerlist) {
        state.bannerList = mybannerlist
    },
    FLOORLIST(state, myfloorlist) {
        state.floorList = myfloorlist
    }

}

const state = {
    categoryList: [],
    bannerList: [],
    floorList: []
}

const getters = {

}

export default {
    actions,
    mutations,
    state,
    getters
}